package exception;

import sun.security.validator.ValidatorException;

import java.util.Map;

/**
 * @Author:Cjj
 * 表单参数以及数据格式校验异常
 */
public class FormValidationException extends ValidatorException {
    /**
     * 字段名
     */
    private String fieldName;

    /**
     * 附件,表单验证错误提升信息
     */
    private Map<String,Object>attachment;

    public FormValidationException(String fieldName,String message){
        super(message);
        this.fieldName = fieldName;
    }

    public FormValidationException(String fieldName,String message,Map<String,Object>attachment){
        super(message);
        this.fieldName = fieldName;
        this.attachment = attachment;
    }

    public  FormValidationException(final String statsCode,final String fieldName,final String message,final Map<String,Object>attachment){
        super(statsCode);
        this.fieldName = fieldName;
        this.attachment = attachment;
    }

    public FormValidationException(final String statsCode,final String fieldName,final String message,final Map<String,Object>attachment,Throwable cause){
        super(statsCode,cause);
        this.fieldName = fieldName;
        this.attachment = attachment;
    }

    public String getFieldName() {
        return fieldName;
    }

    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }

    public Map<String,Object> getAttachment() {
        return attachment;
    }

    public void setAttachment(Map<String,Object> attachment) {
        this.attachment = attachment;
    }
}
